export const curCommunity = { communityId: true };
/**
 * 二进制流 文件转换下载
 * @param {string} bold 二进制流文件
 * @param {string} fileName 下载的文件名,要加文件名后缀
 * 请求的接口头部要上类型  responseType: 'blob'
 */
export function downloadBoldFile(bold, fileName) {
  return new Promise((resolve, reject) => {
    /* 兼容ie内核，360浏览器的兼容模式 */
    if (window.navigator && window.navigator.msSaveOrOpenBlob) {
      let blob = new Blob([bold]);
      window.navigator.msSaveOrOpenBlob(blob, fileName);
    } else {
      var blob = new Blob([bold]);
      var downloadElement = document.createElement("a");
      var href = window.URL.createObjectURL(blob);
      downloadElement.href = href;
      downloadElement.download = fileName;
      document.body.appendChild(downloadElement);
      downloadElement.click();
      document.body.removeChild(downloadElement);
      window.URL.revokeObjectURL(href);
    }
    resolve();
  });
}
